//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CPerspectiveView.h>
///	@path	~/src/graphics/common/
///	@date	2008/11/01
///	@desc	.

#pragma once

#include "xeres.h"

#include "graphics/IView.h"

namespace xeres {

	/*! 
		\class	CPerspectiveView
		\brief
	*/
	class CPerspectiveView : public IView
	{
	public:

		/// \ctor
		CPerspectiveView( void );

		/// \dtor
		virtual ~CPerspectiveView( void );

		DECL_IOBJECT_CLASS_DYNAMIC( CPerspectiveView , IView );

	public:

		///	\name View Interface
		//@{

		/// \brief	Reset view (clipping, viewport).
		virtual void Reset( RenderContext& rc );

		/// \brief	Get camera transform matrix.
		virtual Matrix<float> GetTransform( void );

		/// \brief	Get camera projection matrix.
		virtual Matrix<float> GetProjection( void );

		/// \brief	Set camera transform matrix.
		void SetTransform( const Matrix<float>& mat );

		/// \brief	Set camera transform from base vectors.
		void LookAt( const Vector<float>& eye , const Vector<float>& dir , const Vector<float>& up );

		/// \brief	Set camera projection matrix.
		void SetProjection( float fov , float near_clip , float far_clip );

		/// \brief	Get fov.
		float GetFov( void ) const;

		/// \brief	Set fov.
		void SetFov( float fov );

		/// \brief	Get near.
		float GetNear( void ) const;

		/// \brief	Set near.
		void SetNear( float near_clip );

		/// \brief	Get far.
		float GetFar( void ) const;

		/// \brief	Set far.
		void SetFar( float far_clip );

		//@}

	private:
		
		//@ data
		Matrix<float>		m_viewMatrix;
		Matrix<float>		m_projMatrix;

		// view info.
		float				m_fov;
		float				m_near;
		float				m_far;
		float				m_resX;
		float				m_resY;
		float				m_aspect;
	};
	
} // namespace xeres
